package com.iflytek.iot.zookeeper.lock;

import java.util.concurrent.TimeUnit;

/**
 * @author yu 2019/7/9.
 */
public interface ZookeeperBaseLock<T> {

    int TIME_OUT = 5;

    /**
     * 加锁路径
     * @return
     */
    String getLockPath();

    /**
     * 调用者必须实现该方法来加锁
     * @param <T>
     * @return
     */
    T execute();

    default int getTimeout() {
        return TIME_OUT;
    }

    default TimeUnit getTimeUnit() {
        return TimeUnit.SECONDS;
    }
}
